<template>
  <el-form-item label="使用说明" prop="description">
    <rich-editor :initial-value="props.initialValue" id-name="desc"
      @change="handleDetailTextChange"></rich-editor>
  </el-form-item>
</template>

<script lang="ts" setup>
const props = withDefaults(defineProps<{
  modelValue: string,
  initialValue: string,
}>(), {
  modelValue: ''
})

const emits = defineEmits(['update:model-value'])
// const modelValue = computed({
//   set(newValue) {
//     emits("update:model-value", newValue)
//   },
//   get() {
//     return props.modelValue
//   }
// })

const handleDetailTextChange = ({ innerHTML }: { innerHTML: string }) => {
  // console.log('inner html', innerHTML)
  emits("update:model-value", innerHTML)
}

const rules = [{message: '请输入使用说明', required: true, trigger: 'blur'}]
</script>

<style scoped lang="scss">

</style>
